/* get请求的接收 */
const Koa = require('koa'); 
const app = new Koa();
app.use( async( ctx )=>{
	let url = ctx.url;
	
	//从request中获取GET请求
	let request = ctx.request;
	let req_query = request.query; //格式化好的参数对象
	let req_querystring = request.querystring; //字符串

	//从上下文中直接获取GET请求
	let ctx_query = ctx.query; //参数对象
	let ctx_querystring = ctx.querystring; //字符串

	ctx.body = {
		url,
		req_query,req_querystring,
		ctx_query,ctx_querystring
	}
});
app.listen(3000, ()=>{
	console.log('[demo] server is starting at port 3000');
})